import { snowFlakeId } from '@/utils';
const getDefaultData = () => {
  const componentList = [];
  const data = { id: snowFlakeId(), title: '标题', componentList };
  return data;
};
export const queryFormData = () => {
  const data =
    sessionStorage.getItem('formData') || JSON.stringify(getDefaultData());
  let result = {};
  try {
    result = JSON.parse(data);
  } catch (e) {
    console.error(e);
  }
  return result;
};
export const saveFormData = (data) => {
  sessionStorage.setItem('formData', JSON.stringify(data));
};
